<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改请假单</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">修改请假单</a>
        <br>
        <br>
    </div>
    <br>

    <%--    这里要改--%>
    <form action="LeaveServlet?action=edit" method="post" onsubmit="return check()">
        <input type="hidden" id="id1" name="id" value="${vo.id}"/>

        <table class="index-content-table-add">
            <%--            <tr>--%>
            <%--                <td width="12%">请假单：</td><td><input class="index-content-table-td-add" type="number" id="id" name="id" value="${vo.id}"/></td>--%>
            <%--            </tr>--%>
            <tr>
                <td width="12%">请假事由：</td>
                <td><input class="index-content-table-td-add" type="text" id="reason" name="reason"
                           value="${vo.reason}"/></td>
            </tr>
            <tr>
                <td width="12%">天数：</td>
                <td><input class="index-content-table-td-add" type="number" id="days" name="days" value="${vo.days}"/>
                </td>
            </tr>
            <tr>
                <td width="12%">课程编号：</td>
                <td><input class="index-content-table-td-add" type="number" id="courseId" name="courseId"
                           value="${vo.courseId}"/></td>
            </tr>
            <tr>
                <td width="12%">学号：</td>
                <td><input class="index-content-table-td-add" type="number" id="studentId" name="studentId"
                           value="${vo.studentId}"/></td>
            </tr>
            <tr>
                <td width="12%">状态：</td>
                <td><input class="index-content-table-td-add" type="number" id="status" name="status"
                           value="${vo.status}"/></td>
            </tr>
            <tr>
                <td width="12%">请假时间：</td>
                <td><input class="index-content-table-td-add" type="text" id="applitime" name="applitime"
                           value="${vo.applitime}"/></td>
            </tr>
            <c:if test="${loginUser.userType == '辅导员'}">
                <tr>
                    <td width="12%">审核意见：</td>
                    <td><input class="index-content-table-td-add" type="text" id="opinion" name="opinion"
                               value="${vo.opinion}"/></td>
                </tr>
            </c:if>
            <tr>
                <td width="12%">审核时间：</td>
                <td><input class="index-content-table-td-add" type="text" id="audittime" name="audittime"
                           value="${vo.audittime}"/></td>
            </tr>


        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-pill btn-line btn-success btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button
            type="button" class="btn btn-pill btn-line btn-success btn-sm" onclick="javascript:history.back(-1);">取消
    </button>
    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("id").value.trim().length == 0) {
            alert("请假单号称不能为空!");
            return false;
        }
        if (document.getElementById("courseId").value.trim().length == 0) {

            console.log(document.getElementById("courseId").value)
            alert("课程编号不能为空!");
            return false;
        }

        return true;
    }
</script>
</html>
